import {createSlice, PayloadAction} from '@reduxjs/toolkit'

const UserSlice = createSlice({
    name: 'user',
    initialState: {
        token: '',
        app_id: '',
        store_id: ''
    },
    reducers: {
        userLogin() {

        },
        setToken(state, action){
            state.token = action.payload
        },
        setAppid(state, action){
            state.app_id = action.payload
        }
        ,
        setStoreid(state, action){
            state.store_id = action.payload
        }
    }
})
// 用于执行更新state的action
export const {
    setToken,
    setAppid,
    setStoreid
} = UserSlice.actions
// reduer
export default UserSlice.reducer;
/*
output:
{
  name: 'counter',
  actions : {
    increment,
    decrement,
    incrementByAmount,
    decrementByAmount
  },
  reducer
}
*/